$server = 'http://localhost:8080/';

window.onload = function(){
	$.ajax(
	{
		url: $server+'user/get_user_info.do',
		type: "POST",
		datatype: 'json',		
		crossDomain:true, //设置跨域为true
		xhrFields:{
			withCredentials: true // 携带跨域cookie
		},
		success: function(result){
			if (result.code == 200){
				$('.username')[0].innerHTML = result.data.username;
			}else{
				alert(result.msg);
			}
		},
	});
}